/*
 * TankMotorCtrl.cpp
 *
 *  Created on: Dec 28, 2012
 *      Author: andelhie
 */
#include "Arduino.h"
#include "TankMotorCtrl.h"

TankMotor::TankMotor(int pinNum, int time) {
	pinMode(pinNum, OUTPUT);
	_pinNum = pinNum;
	_time = time;
}

void TankMotor::RunMotor() {
	digitalWrite(_pinNum, HIGH); //turn pin on
	if (_time == 0) // if the time is set to 0 then
			{
		//do nothing
	} else // do this as needed
	{
		delay(_time); //stay on for set time
		digitalWrite(_pinNum, LOW); //turn pin off
		delay(500);  // a small delay before the next thing happen
	}
}

